package com.zhida.jiyangcenter.api

import chooongg.base.manager.app
import chooongg.http.HttpCallback
import chooongg.http.HttpManager
import com.vehicle.inspection.api.BaseTokenInterceptor
import com.zhida.jiyangcenter.DEFAULT_ROW
import com.zhida.jiyangcenter.utils.SP
import okhttp3.RequestBody
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.*

interface APIAccount {
    companion object {
        fun service() =
            HttpManager.create(app.applicationContext, "http://beauty.hebzd.com/api/mine/") {
                addConverterFactory(GsonConverterFactory.create())
                addInterceptor("mine", BaseTokenInterceptor())
            }.getAPI(APIAccount::class.java)
    }

    /**
     *
     */
    @POST("login")
    @FormUrlEncoded
    suspend fun login(
        @Field("phone") phone: String,
        @Field("kind") kind: Int,
        @Field("password") password: String? = null,
        @Field("code") code: String? = null,
        @Field("referral_code") referral_code: String? = null,
        @Field("wechat_openid") wechat_openid: String? = null
    ): NetResponse<LoginEntity>

    /**
     *
     */
    @POST("WeChar/login")
    @FormUrlEncoded
    suspend fun weCharLogin(
        @Field("wechat_openid") wechat_openid: String
    ): NetResponse<LoginEntity>

    /**
     *发送验证码
     */
    @POST("send/code")
    @FormUrlEncoded
    suspend fun sendCode(@Field("phone") phone: String): NetResponse<Any>

    /**
     *设置登录密码
     */
    @POST("password/add")
    @FormUrlEncoded
    suspend fun passwordAdd(
        @Field("pwd") pwd: String,
        @Field("pwd_check") pwd_check: String
    ): NetResponse<Any>

    /**
     *忘记登录密码
     */
    @POST("password/forget")
    @FormUrlEncoded
    suspend fun passwordForget(
        @Field("pwd") pwd: String,
        @Field("pwd_check") pwd_check: String
    ): NetResponse<Any>

    /**
     *地址添加
     */
    @POST("address/add")
    @FormUrlEncoded
    suspend fun addressAdd(
        @Field("name") name: String,
        @Field("phone") phone: String,
        @Field("postcode") postcode: String,
        @Field("detail") detail: String,
        @Field("is_default") is_default: String,
        @Field("province") province: String,
        @Field("city") city: String,
        @Field("district") district: String
    ): NetResponse<Any>

    /**
     *地址编辑
     */
    @POST("address/compile2")
    @FormUrlEncoded
    suspend fun addressCompile2(
        @Field("name") name: String,
        @Field("phone") phone: String,
        @Field("postcode") postcode: String,
        @Field("detail") detail: String,
        @Field("is_default") is_default: String,
        @Field("province") province: String,
        @Field("city") city: String,
        @Field("district") district: String,
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *地址列表
     */
    @POST("address")
    suspend fun address(
    ): NetResponse<List<AddressEntity>>

    /**
     *地址删除
     */
    @POST("address/delete")
    @FormUrlEncoded
    suspend fun addressDelete(
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *地址默认
     */
    @POST("address/defaultAddress")
    suspend fun defaultAddress(
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *地址默认
     */
    @POST("address/default/cancel")
    @FormUrlEncoded
    suspend fun defaultCancel(
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *地址回显
     */
    @POST("address/compile1")
    @FormUrlEncoded
    suspend fun addressCompile1(
        @Field("parm") parm: String
    ): NetResponse<AddressDetailsEntity>

    /**
     *添加收藏
     */
    @POST("collection/add")
    @FormUrlEncoded
    suspend fun collectionAdd(
        @Field("belong_type") belong_type: String,
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *删除收藏
     */
    @POST("collection/delete")
    @FormUrlEncoded
    suspend fun collectionDelete(
        @Field("belong_type") belong_type: String,
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *收藏列表
     */
    @POST("collection/list")
    @FormUrlEncoded
    suspend fun collectionList(
        @Field("PageNumber") PageNumber: Int,
        @Field("form") form: Int,
        @Field("PageSize") PageSize: Int = DEFAULT_ROW
    ): NetResponse<CollectionListEntity>

    /**
     *商品订单列表---全部-待付款-待收货-退款
     */
    @POST("product/order/list")
    @FormUrlEncoded
    suspend fun productOrderList(
        @Field("PageNumber") PageNumber: Int,
        @Field("state") state: Int,
        @Field("PageSize") PageSize: Int = DEFAULT_ROW
    ): NetResponse<ProductOrderListEntity>

    /**
     *服务订单列表---全部-待付款-待服务-退款
     */
    @POST("serve/order/list")
    @FormUrlEncoded
    suspend fun serveOrderList(
        @Field("PageNumber") PageNumber: Int,
        @Field("state") state: Int,
        @Field("PageSize") PageSize: Int = DEFAULT_ROW
    ): NetResponse<ServeOrderListEntity>

    /**
     *设备管理
     */
    @POST("device/list")
    @FormUrlEncoded
    suspend fun deviceList(
        @Field("PageNumber") PageNumber: Int,
        @Field("PageSize") PageSize: Int = DEFAULT_ROW
    ): NetResponse<List<DeviceListEntity>>

    /**
     *商品订单退款
     */
    @POST("product/order/refund")
    @FormUrlEncoded
    suspend fun productOrderRefund(
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *服务订单退款
     */
    @POST("serve/order/refund")
    @FormUrlEncoded
    suspend fun serveOrderRefund(
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *服务查看服务码
     */
    @POST("serve/code")
    @FormUrlEncoded
    suspend fun serveCode(
        @Field("parm") parm: String
    ): NetResponse<ServeCodeEntity>

    /**
     *商品订单收货
     */
    @POST("product/order/receiving")
    @FormUrlEncoded
    suspend fun productOrderReceiving(
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *服务订单确认
     */
    @POST("serve/order/receiving")
    @FormUrlEncoded
    suspend fun serveOrderReceiving(
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *服务订单取消
     */
    @POST("serve/order/cancel")
    @FormUrlEncoded
    suspend fun serveOrderCancel(
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *商品订单取消
     */
    @POST("product/order/cancel")
    @FormUrlEncoded
    suspend fun productOrderCancel(
        @Field("parm") parm: String
    ): NetResponse<Any>

    /**
     *商品订单详情
     */
    @POST("product/order/info")
    @FormUrlEncoded
    suspend fun productOrderInfo(
        @Field("parm") parm: String
    ): NetResponse<ProductOrderInfoEntity>

    /**
     *服务订单详情
     */
    @POST("serve/order/info")
    @FormUrlEncoded
    suspend fun serveOrderInfo(
        @Field("parm") parm: String
    ): NetResponse<ServeOrderInfoEntity>

    /**
     *服务订单详情
     */
    @POST("serve/order/info")
    @FormUrlEncoded
    suspend fun serveOrderInfo1(
        @Field("order_code") parm: String
    ): NetResponse<ServeOrderInfoEntity>

    /**
     *评价中物品的展示
     */
    @POST("comment/goods/show")
    @FormUrlEncoded
    suspend fun commentGoodsShow(
        @Field("parm") parm: String,
        @Field("form") form: String
    ): NetResponse<List<CommentGoodsShowEntity>>

    /**
     *添加昵称
     */
    @POST("nickname/add")
    @FormUrlEncoded
    suspend fun nicknameAdd(
        @Field("nickname") parm: String
    ): NetResponse<Any>

    /**
     *性别
     */
    @POST("sex/add")
    @FormUrlEncoded
    suspend fun sexAdd(
        @Field("gender") parm: String
    ): NetResponse<Any>

    /**
     *生日
     */
    @POST("birthday/add")
    @FormUrlEncoded
    suspend fun birthdayAdd(
        @Field("birthday") parm: String
    ): NetResponse<Any>

    /**
     *所在城市
     */
    @POST("area/add")
    @FormUrlEncoded
    suspend fun areaAdd(
        @Field("area") parm: String
    ): NetResponse<Any>

    /**
     *设置支付密码
     */
    @POST("pays_password/add")
    @FormUrlEncoded
    suspend fun paysPassword(
        @Field("pwd_check") pwd_check: String,
        @Field("pwd") pwd: String,
        @Field("code") code: String
    ): NetResponse<Any>

    /**
     *修改支付密码
     */
    @POST("pays_password/edit")
    @FormUrlEncoded
    suspend fun paysPasswordChage(
        @Field("old_pwd") old_pwd: String,
        @Field("new_pwd") new_pwd: String
    ): NetResponse<Any>

    /**
     *验证支付密码
     */
    @POST("pays_password/verify")
    @FormUrlEncoded
    suspend fun paysPasswordVerify(
        @Field("password") password: String
    ): NetResponse<Any>

    /**
     *订单评论
     */
    @JvmSuppressWildcards
    @POST("comment/add")
    @Multipart
    suspend fun commentAdd(
        @Part("order_uuid") order_uuid: RequestBody,
        @Part("form") form: RequestBody,
        @Part("describes") describes: RequestBody,
        @Part("logistics") logistics: RequestBody,
        @Part("attitude") attitude: RequestBody,
        @Part("comment") comment: RequestBody,
        @Part("is_hide") is_hide: RequestBody,
        @PartMap picture: Map<String, RequestBody>
    ): @JvmSuppressWildcards NetResponse<Any>

    /**
     *上传头像
     */
    @JvmSuppressWildcards
    @POST("picture")
    @Multipart
    suspend fun picture(
        @PartMap pic: Map<String, RequestBody>
    ): @JvmSuppressWildcards NetResponse<Any>

    /**
     *投诉建议
     */
    @JvmSuppressWildcards
    @POST("complaint/add")
    @Multipart
    suspend fun complaintAdd(
        @Part("description") description: RequestBody,
        @PartMap pic: Map<String, RequestBody>
    ): @JvmSuppressWildcards NetResponse<Any>

    /**
     *个人信息
     */
    @POST("personal/info")
    suspend fun personalInfo(): NetResponse<PersonalInfoEntity>

    /**
     *推荐码查看
     */
    @POST("referral/code")
    suspend fun referralCode(): NetResponse<ReferralCodeEntity>

    /**
     *更新app
     */
    @POST("update")
    suspend fun update(): NetResponse<UpdataEntity>

}